using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { method2(); } private void method1() { Console.WriteLine("input the row number:"); int rowno = int.Parse(Console.ReadLine()); //int [][] a = new int [rowno+1][rowno+1]; int[,] a = new int[rowno + 1, rowno + 1]; for (int i = 0; i < rowno; i++) { for (int j = 0; j <= i; j++) { if (j == 0 || j == i) { a[i, j] = 1; } else { a[i, j] = a[i - 1, j - 1] + a[i - 1, j]; } Console.Write("{0}/t", a[i, j]); } Console.WriteLine(); } Console.ReadKey(); } private static void method2() { Console.WriteLine("input the row number:"); int rowno = int.Parse(Console.ReadLine()); int c = 0; for (int i = 0; i < rowno; i++) { for (int j = 0; j < rowno - i; j++) { Console.Write(" "); } c = 1; for (int j = 0; j <= i; j++) { Console.Write("{0} ", c); c = c * (i - j) / (j + 1); } Console.WriteLine(); } Console.ReadKey(); } } }